import 'package:flutter/material.dart';
import 'package:hospitable_rental/routes/routes.dart';
import 'package:hospitable_rental/viewmodels/auth_viewmodel.dart';
import 'package:provider/provider.dart';

class FunctionButtonItem {
  final String imageUri;
  final String title;
  final Function? onTapHandler;

  const FunctionButtonItem(
    this.imageUri,
    this.title,
    this.onTapHandler,
  );
}

final List<FunctionButtonItem> buttonItemList = [
  FunctionButtonItem(
    "assets/icons/profile_record.png",
    "看房记录",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_order.png",
    "我的订单",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_favor.png",
    "我的收藏",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_idcard.png",
    "身份认证",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_message.png",
    "联系我们",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_contract.png",
    "电子合同",
    null,
  ),
  FunctionButtonItem(
    "assets/icons/profile_house.png",
    "房屋管理",
    (BuildContext context) {
      bool isLogin = context.read<AuthViewModel>().isLogin;
      if (isLogin) {
        Navigator.of(context).pushNamed(Routes.roomsManage);
      } else {
        Navigator.of(context).pushNamed(Routes.login);
      }
    },
  ),
  FunctionButtonItem(
    "assets/icons/profile_wallet.png",
    "我的钱包",
    null,
  ),
];
